// FriendDao.java
package com.example.app.Entity;

import androidx.room.Dao;
import androidx.room.Insert;
import androidx.room.OnConflictStrategy;
import androidx.room.Query;

import java.util.List;

@Dao
public interface FriendDao {
    @Insert(onConflict = OnConflictStrategy.REPLACE)
    void insert(FriendEntity friend);

    @Query("DELETE FROM friends WHERE userId = :userId")
    void deleteByUserId(String userId);

    @Query("SELECT users.* FROM friends " +
           "INNER JOIN users ON friends.friendUserId = users.userId " +
           "WHERE friends.userId = :userId")
    List<UserEntity> getFriendsForUser(String userId);
}